package day03

/**
  * Created by root on 2018/11/22.
  */
//定义属性的时候不能只声明变量

class Boy{
  //私有的不能提供访问
  //加上this后半生对象不能够访问得到
  private[this] val name:String = "老许"
  var age:Int = _

  def getName: String ={
    name
  }

}

object Boy{
  def testPrivate: Unit ={
    val boy: Boy = new Boy
    //this 后伴生对象不能访问得到
    //println(boy.name)
  }
}
object PrivateColame {
  def main(args: Array[String]): Unit = {
    val boy = new Boy
    println(boy.age)
    println(boy.getName)


  }

}
